{% extends "base.html" %}
{% block title %} Templates | sh00t{% endblock %}

{% block page %}
<ol class="breadcrumb">
    <li class="breadcrumb-item">
      <a href="/">Dashboard</a>
    </li>
    <li class="breadcrumb-item active"> <i class="fa fa-palette"></i> Template</li>
</ol>
<div class="row">
    <div class="col-lg-6">
        <form role="form" method="post">
            {% if "success" == submitted %}
                <div class="row">
                    <div class="col-lg-12">
                        <div class="alert alert-info alert-dismissable">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <i class="fa fa-info-circle"></i> Submitted
                        </div>
                    </div>
                </div>
            {% endif %}
            <div class="form-group">
                <label>Name</label>
                <input class="form-control" name="name" autocomplete="off" />
            </div>
            <div class="form-group">
                <label>Body</label>
                <textarea class="form-control" rows="10" name="body"></textarea>
            </div>
            <button type="submit" class="btn btn-primary">Submit</button>
            {% csrf_token %}
        </form>
    </div>
    <div class="col-lg-6">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class="panel-title"><i class="fa fa-palette"></i> Recent Templates</h4>
            </div>
            <div class="panel-body">
                {% if templates %}
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover table-striped">
                            <thead>
                                <tr>
                                    <th>Name</th>
                                </tr>
                            </thead>
                            <tbody>
                                {% for template in templates %}
                                    <tr>
                                        <td><a href="/app/template/{{ template.id }}/">{{ template.name }}</a></td>
                                    </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    </div>
                    <div class="text-right">
                        <a href="/admin/app/template/" target="_blank">View All <i class="fa fa-arrow-circle-right"></i></a>
                    </div>
                {% else %}
                    <br />
                    <h5>No Templates yet. Create one.</h5>
                {% endif %}
            </div>
        </div>
    </div>
</div>
<!-- /.row -->
{% endblock %}
